<template>
    <div class="code">
      <img class="code-pic" :src="img" @click="showImagePreview">
    </div>
</template>
<script lang="ts">
    // @ is an alias to /src
    import {Component} from "vue-property-decorator";
    import Sence from "../sence/Sence";

    @Component({
        components: {},
    })

    export default class Code extends Sence {
         public img:string='';// 二维码图片

        /**
         * 初始化
         */
        public mounted():void{
            this.poster();
        }

        /**
         * 获取二维码接口
         */
        public poster():void{
           this.post('api/user.dealer.qrcode/poster',{}).then((res:any)=>{
               this.img=res.data.qrcode
           })
         }

        /**
         * 打开图片
         */
        public showImagePreview():void{
            (<any>this).$createImagePreview({
                imgs: [this.img]
            }).show()
        }
    }


</script>

<style scoped lang="stylus">
    .code-pic
       position fixed
       margin auto
       top 0
       bottom 0
       left 0
       right 0
       width 100vw
</style>
